﻿using IntelligentAgriculture.Contracts.Interface.SheepFileModelInterface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.SheepfilemodelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepfilemodelCommandHandler
{
	/// <summary>
	/// 判断羊只档案状态
	/// </summary>
	/// <returns></returns>
	public class IsSexSheepfilemodelCommandHandler : IRequestHandler<IsSexSheepfilemodelCommand, Results<IQueryable<Sheepfilemodel>>>
	{
		private readonly ISheepFileModelService _sheepFileModelService;
		public IsSexSheepfilemodelCommandHandler(ISheepFileModelService sheepFileModelService)
		{
			_sheepFileModelService = sheepFileModelService;
		}
		public async Task<Results<IQueryable<Sheepfilemodel>>> Handle(IsSexSheepfilemodelCommand request, CancellationToken cancellationToken)
		{
			var list=await _sheepFileModelService.IsSexSheepfilemodel(request.presentState, request.sheepType);
			return Results<IQueryable<Sheepfilemodel>>.DataResult(list);
		}
	}
}
